Skip to content

Add refresh-images endpoint for channels#21

Merged
windoze95 merged 2 commits intomainfrom
feature/refresh-channel-images-on-open
Mar 6, 2026
Merged

Add refresh-images endpoint for channels#21
windoze95 merged 2 commits intomainfrom
feature/refresh-channel-images-on-open

Conversation

@windoze95
Copy link
Owner

Summary

  • Adds POST /api/channels/{id}/refresh-images endpoint that fetches fresh avatar and banner URLs from YouTube and updates the channel record
  • Only overwrites existing URLs if the fetch returns non-null values, so images are never accidentally cleared
  • Returns updated ChannelDetail so the client can immediately use the new URLs

Test plan

  • Open a channel detail page and verify backend logs show the image fetch
  • Confirm avatar_url and banner_url are updated in the database after the call
  • Verify the endpoint returns 404 for a non-existent channel ID
  • Verify authentication is required (no X-User-Token → 401)

🤖 Generated with Claude Code

POST /api/channels/{id}/refresh-images fetches fresh avatar and banner
URLs from YouTube and updates the channel record, so images stay current
whenever a user opens a channel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6e54573eec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The POST /api/channels/{id}/refresh-images endpoint was returning
ChannelDetail with default values for subscriber_count, video_count,
is_subscribed, and tracking_mode because it never queried for those
derived fields. This caused UI state desync after a successful image
refresh. Now populates all stats the same way get_channel does.

https://claude.ai/code/session_01MaYebt19nccXjyuYueW9oq
@windoze95 windoze95 merged commit fc0e386 into main Mar 6, 2026
5 checks passed
@windoze95 windoze95 deleted the feature/refresh-channel-images-on-open branch March 6, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants